#include <iostream>
#include <string>
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

using namespace std;

const string fifoname = "./fifo";
const mode_t fifomode = 0600;
const int openw= O_WRONLY;
const int openr= O_RDONLY;
const int gsize=1024;

class OperatFile
{
public:
    OperatFile()
    {
    }
    // 传入1传入2写
    bool OpenFide(int type)
    {
        _fd = open(fifoname.c_str(),type);
        if(_fd<0)
        {
            cout<<"打开文件失败"<<endl;
            return false;
        }
        return true;
    }
    int Fd()
    {
        return _fd;
    }

    void Close()
    {
        close(_fd);
    }
private:
    int _fd;
};
